﻿using System;
using System.Collections.Generic;

namespace CommonEngine.SDK
{
    /// <summary>
    /// RESTful行为规则(for WebApi)
    /// </summary>
    public enum ApiActCode
    {
        Select = 1,
        Find = 2,
        Add = 3,
        Update = 4,
        Delete = 5,
        Ext = 6 //扩展操作
    }
    /// <summary>
    /// 请求参数池(for WebApi)
    /// </summary>
    [Serializable]
    public class ParametersPool<T> where T : class
    {
        public Dictionary<string, string> parameters { get; set; }

        public string id { get; set; }
        public T Entity { get; set; }
        public ApiActCode ActCode { get; set; }
        public string Token { get; set; }
        public string Secretkey { get; set; }
        public string Account { get; set; }
    }
    /// <summary>
    /// 返回数据包(for WebApi)
    /// </summary>
    [Serializable]
    public class ReturnResult<T> where T : class
    {
        public bool Success { get; set; }
        public string info { get; set; }

        public T Data { get; set; }
        public List<T> List { get; set; }

        public string Answer { get; set; }
        public ApiActCode ActCode { get; set; }
    }
    /// <summary>
    /// 响应封装(for Client)
    /// </summary>
    [Serializable]
    public sealed class ResponseInfo
    {
        public string Associated { get; set; }  //响应头
        public string StatusCode { get; set; }  //状态码
        public string ReplyMsg { get; set; }    //回复消息
        public string Result { get; set; }      //返回数据
    }
}
